#pragma once

#include "cScene.h"
#include "cPlayer.h"
#include "cData.h"
#include "InputManager.h"
#include "Screen.h"
#include "PlayerInfo.h"
#include "PlayerInfoStats.h"
#include "Scope.h"

#define GAME_WIDTH	800
#define GAME_HEIGHT 608

class cGame
{
public:
	enum KeyState
	{
		UP,
		DOWN
	};
	struct Key
	{
		unsigned char code;
		KeyState state;
	};

	enum GameState{
		STATE_MAINMENU,
		STATE_PLAYING,
		STATE_CONTROLS,
		STATE_SCORES,
		STATE_CREDITS,
	};

	enum RoomState{
		STATE_ROOM01,
		STATE_ROOM02,
		STATE_ROOM03,
		STATE_ROOM04,
		STATE_ROOM05,
		STATE_ROOM06,
	};

	enum MessageState{
		MESSAGE_ON,
		MESSAGE_OFF,
	};

	enum ShuffleMessage{
		SHUFFLE_ON,
		SHUFFLE_OFF,
	};

	cGame(void);
	virtual ~cGame(void);

	bool Init();
	bool Loop();
	void Finalize();

	//Input
	void ReadKeyboard(unsigned char key, int x, int y, bool press);
	void ReadMouse(int button, int state, int x, int y);
	//Process
	bool Process();
	void AddObject(cBicho*);
	void RemoveObject(int);
	//Output
	void Render();

	//GameState
	GameState GameGetState();
	void GameSetState(GameState);

	//RoomState

	bool PlayerIsOnDoor(int x, int y, std::pair<std::pair<int, int>, std::pair<int, int>>);
	RoomState RoomGetState();
	void RoomSetState(RoomState);

	//Message

	MessageState MessageGetState();
	void MessageSetState(MessageState);

	ShuffleMessage ShuffleGetMessage();
	void ShuffleSetMessage(ShuffleMessage);

private:

	GameState m_gamestate;

	RoomState m_roomstate;

	MessageState m_messagestate;
	
	ShuffleMessage m_shufflemesage;

	int m_x, m_y;
	int m_counterradioactivity;
	int m_countermessage;
	int m_countershuffle;
	
	bool m_pressUp;
	bool m_pressDown;

	bool m_inicipantalla;
	bool m_initialload;
	bool m_finalroom;


	bool m_origenroom05;
	bool m_shuffleradioactivity;

	Key keys[258];

	cScene Scene;
	cData Data;
	InputManager m_inputManager;
	Screen m_screen;
	std::vector<cBicho *> m_objectList;
	int m_objectCount;
	PlayerInfo m_playerinfo;
	PlayerInfoStats m_playerinfostats;
	Scope m_scope;

	

};
